#!/usr/bin/env python
# -*- coding: utf-8 -*-

from typing import Any

from cta.interface.action.calculate_data.abstract_calculate_data_action import AbstractCalculateDataAction
from web.constants.datetime_format import DatetimeFormat
from web.domain.responsibility_chain_dto import ResponsibilityChainDto
from web.manager.log_manager import LogManager
from web.util.datetime_util import DatetimeUtil

Logger = LogManager.get_logger(__name__)

class CalculateQuant2MaDataAction(AbstractCalculateDataAction):
    """
    多因子策略，计算MA数据
    """

    def exec(self, responsibility_chain_dto: ResponsibilityChainDto = None) -> Any:
        transaction_date: str = responsibility_chain_dto.transaction_date

        Logger.info("多因子策略，计算MA数据，日期[%s]", transaction_date)

        # 根据日期，计算ma数据
        self.quant2_account_log_dao.write_ma_by_date(transaction_date)

        super().next(responsibility_chain_dto)